using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class webpages_Membership
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region webpages_MembershipSelectAll
        public static SqlDataReader webpages_MembershipSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_MembershipSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_MembershipSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region webpages_MembershipSelectRow
        public static SqlDataReader webpages_MembershipSelectRow(int UserId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_MembershipSelectRow", UserId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_MembershipSelectRow", UserId);
        }
        #endregion
       #region webpages_MembershipInsertRow
        public static void webpages_MembershipInsertRow(int UserId, DateTime CreateDate, string ConfirmationToken, bool IsConfirmed, DateTime LastPasswordFailureDate, int PasswordFailuresSinceLastSuccess, string Password, DateTime PasswordChangedDate, string PasswordSalt, string PasswordVerificationToken, DateTime PasswordVerificationTokenExpirationDate, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_MembershipInsertRow", UserId, CreateDate, ConfirmationToken, IsConfirmed, LastPasswordFailureDate, PasswordFailuresSinceLastSuccess, Password, PasswordChangedDate, PasswordSalt, PasswordVerificationToken, PasswordVerificationTokenExpirationDate);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_MembershipInsertRow", UserId, CreateDate, ConfirmationToken, IsConfirmed, LastPasswordFailureDate, PasswordFailuresSinceLastSuccess, Password, PasswordChangedDate, PasswordSalt, PasswordVerificationToken, PasswordVerificationTokenExpirationDate);
        }
        #endregion
       #region webpages_MembershipUpdateRow
        public static void webpages_MembershipUpdateRow(int UserId, DateTime CreateDate, string ConfirmationToken, bool IsConfirmed, DateTime LastPasswordFailureDate, int PasswordFailuresSinceLastSuccess, string Password, DateTime PasswordChangedDate, string PasswordSalt, string PasswordVerificationToken, DateTime PasswordVerificationTokenExpirationDate, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_MembershipUpdateRow", UserId, CreateDate, ConfirmationToken, IsConfirmed, LastPasswordFailureDate, PasswordFailuresSinceLastSuccess, Password, PasswordChangedDate, PasswordSalt, PasswordVerificationToken, PasswordVerificationTokenExpirationDate);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_MembershipUpdateRow", UserId, CreateDate, ConfirmationToken, IsConfirmed, LastPasswordFailureDate, PasswordFailuresSinceLastSuccess, Password, PasswordChangedDate, PasswordSalt, PasswordVerificationToken, PasswordVerificationTokenExpirationDate);
        }
        #endregion
       #region webpages_MembershipDeleteRow
        public static void webpages_MembershipDeleteRow(int UserId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_MembershipDeleteRow", UserId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_MembershipDeleteRow", UserId);
        }
        #endregion

    }
}

